package com.imti.mall.sale.mapper;

import com.imti.mall.model.sms.pojo.SmsFlashPromotionSession;
import org.apache.ibatis.jdbc.SQL;

public class SmsFlashPromotionSessionDynaSqlProvider {
    /**
     * 根据id修改限时购场次表
     * @param smsFlashPromotionSession
     * @return
     */

    public String updateSmsFlashPromotionSession(final SmsFlashPromotionSession smsFlashPromotionSession){
        return new SQL(){
            {
                UPDATE(" sms_flash_promotion_session ");


                if(smsFlashPromotionSession!=null) {

                    if (smsFlashPromotionSession.getName() != null) {
                        SET(" name=#{name}");
                    }
                    if (smsFlashPromotionSession.getStartTime() != null) {
                        SET("  start_time=#{ startTime}");
                    }
                    if (smsFlashPromotionSession.getStatus() != null) {
                        SET(" status=#{status}");
                    }
                    if (smsFlashPromotionSession.getEndTime() != null) {
                        SET(" end_time=#{endTime}");
                    }

                    if (smsFlashPromotionSession.getCreateTime() != null) {
                        SET(" create_time=#{createTime}");
                    }
                }
                WHERE(" id=#{id} ");

            }
        }.toString();


    }
}
